<?php

class DBError{
    
    protected $functions = array();
    protected $default_message = "Erro desconhecido no banco de dados!";
    public function getMessage($msg){
        foreach($this->functions as $fc){
            if(strstr($msg, "$fc")){
                $fc = "f$fc";
                if(method_exists($this, $fc))
                 return $this->$fc($msg);
            }
        }
        return $this->default_message;
    }
}

?>
